/**
 *  EKology - An Ecosystem Simulation Framework
 *  Copyright (C) 2008  Aarón Tavío - aaron.tavio at gmail.com - ULPGC
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

package fungusEater;

import fungusEater.datatypes.*;

import net.ekology.ekosystem.datatypes.EKVector;

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;


/**
 * @author Aarón Tavío - aaron.tavio at gmail.com
 * @version 1.0.0 - 20081019-1700
 */
public class FungusEaterHelper {
    public static String generateID() {
        DateFormat oDateFormat = new SimpleDateFormat("yyyy/MM/dd-HH:MM:ss:SSS");
        
        return oDateFormat.format(new Date());
    }
    
    
    public static EKVector getRandomPosition(double maxX, double maxY) {
        EKVector oResult;
        
        oResult = new EKVector(maxX * Math.random()-(maxY/2), maxY * Math.random()-(maxY/2));
        
        return oResult;
    }
    
    
    public static double getRandomValue(double dMaxValue, double dMinValue) {
        return (dMaxValue-dMinValue)*Math.random()+dMinValue;
    }
    
    public static OreType getRandomOreType() {
        OreType oResult;
        double dRandom;
        
        dRandom = Math.random();
        
        if (dRandom < 0.3) oResult = OreType.A_TYPE;
        else if (dRandom < 0.6) oResult = OreType.B_TYPE;
        else oResult = OreType.C_TYPE;
        
        
        return oResult;
    }
    
    public static FungusType getRandomFungusType() {
        FungusType oResult;
        double dRandom;
        
        dRandom = Math.random();
        
        if (dRandom < 0.3) oResult = FungusType.A_TYPE;
        else if (dRandom < 0.6) oResult = FungusType.B_TYPE;
        else oResult = FungusType.C_TYPE;
        
        
        return oResult;
    }
}
